// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#include "SfxManager.h"
#include "SpecialEffects.h"
#include "GameManager.h"

using namespace std;

SfxManager::SfxManager(void)
{
}

SfxManager::~SfxManager(void)
{
}

// Starts an effect for an entity
void SfxManager::startEffect(SpaceObject* so, SfxType effectType, float totalTime)
{
	ObjectEffectInfo & effectInfo = effectInformation[so];
	if (effectInfo.startEffect(effectType, totalTime)) {
		switch(effectType) {
			case SFXT_OPEN_FIRE:
				openFire(so);
				break;
			case SFXT_METHI_FIRE:
				methiFire(so);
				break;
			case SFXT_RECEIVE_DAMAGE:
				receiveDamage(so->getPosition());
				break;
			case SFXT_SMOKE:
				smokeEffect(GameManager::getInstance()->findEntity(so));
				break;
			case SFXT_SMOKE_OFF:
				offSmokeEffect(GameManager::getInstance()->findEntity(so));
				break;
			case SFXT_TRAIL:
				trail(so);
				break;
		}
	}
}

// Resets an effect timer for an entity
void SfxManager::resetEffect(SpaceObject* so, SfxType effectType)
{
	ObjectEffectInfo & effectInfo = effectInformation[so];
	effectInfo.resetEffect(effectType);	
}
